﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Admin.Core.Common.Input;
using Admin.Core.Common.Output;
using Admin.Core.Model.Warehouse;
using Admin.Core.Service.Warehouse.XbcWarehouse;
using Admin.Core.Service.Warehouse.XbcWarehouse.Input;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace Admin.Core.Controllers.Warehouse
{
    public class XbcWarehouseController  :AreaController
    {
        private readonly IXbcWarehouseService _xbcWarehouseService;

        public XbcWarehouseController(IXbcWarehouseService xbcWarehouseService)
        {
            _xbcWarehouseService = xbcWarehouseService;
        }



        /// <summary>
        /// 查询单条仓库信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> Get(long id)
        {
            return await _xbcWarehouseService.GetAsync(id);
        }


        /// <summary>
        /// 分页查询仓库信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> GetPage(PageInput<XbcWarehouseEntity> model)
        {
            return await _xbcWarehouseService.PageAsync(model);


        }

        /// <summary>
        /// 新增仓库
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IResponseOutput> Add(XbcWarehouseAddInput input)
        {
            return await _xbcWarehouseService.AddAsync(input);
        }

        /// <summary>
        /// 修改仓库
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IResponseOutput> Update(XbWarehouseUpdateInput input)
        {
            return await _xbcWarehouseService.UpdateAsync(input);
        }

        /// <summary>
        /// 查询仓库列表
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<IResponseOutput> GetWarehouseList()
        {
            return await _xbcWarehouseService.GetWarehouseList();
        }
        /// <summary>
        /// 删除仓库
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<IResponseOutput> SoftDelete(long id)
        {
            return await _xbcWarehouseService.SoftDeleteAsync(id);
        }

        /// <summary>
        /// 批量删除仓库
        /// </summary>
        /// <param name="ids"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<IResponseOutput> BatchSoftDelete(long[] ids)
        {
            return await _xbcWarehouseService.BatchSoftDeleteAsync(ids);
        }







    }
}
